package com.shujia.socket;

import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws Exception {
        //建立连接   搭建了一个传输数据的管道
        Socket socket = new Socket("localhost", 8888);

        //客户端发送数据到服务端
        OutputStream outputStream = socket.getOutputStream();
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
        outputStreamWriter.write("你好");
        outputStreamWriter.flush();



    }
}
